<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<#include "common/head.ftl">

<body class="gray-bg">
    <#include "common/modal.ftl">
<div class="middle-box text-center loginscreen  animated fadeInDown" style="padding-top:5px;">
    <div>
        <div>
            <h1 class="logo-name" style="width:200%;margin-left:-50%;font-size: 110px;">会务宝</h1>
        </div>
        <h3>欢迎注册 会务宝管理员账户</h3>
        <p>创建一个会务宝管理员新账户</p>

        <form class="m-t" role="form" action="">
            <div class="form-group">
                <input type="text" name="username" class="form-control" placeholder="请输入用户名" required="true">
            </div>
            <div class="form-group">
                <input type="password" name="password" class="form-control" placeholder="请输入密码" required="true">
            </div>
            <div class="form-group">
                <input type="password" name="confrim-password" class="form-control" placeholder="请确认密码" required="true">
            </div>
            <div class="form-group">
                <input type="text" name="enterpriseName" class="form-control" placeholder="请输入企业名称" required="true">
            </div>
            <div class="form-group">
                <input type="text" name="enterpriseCode" class="form-control" placeholder="请输入企业组织机构代码" required="true">
            </div>
            <div class="form-group">
                <input type="text" name="enterpriseAddress" class="form-control" placeholder="请输入企业地址" required="true">
            </div>
            <div class="form-group">
                <input type="text" name="phone" class="form-control" placeholder="请输入手机号" required="true">
            </div>
            <div class="form-group">
                <input type="text" name="email" class="form-control" placeholder="请输入邮箱" required="true">
            </div>
            <button type="button" class="btn btn-primary block full-width m-b register">注 册</button>
            <p class="text-muted text-center">
                <small>已经有账户了？</small>
                <a href="${basePath}/loginAndLogout/login">点此登录</a>
            </p>

        </form>
    </div>
</div>

<!-- 全局js -->
<script src="${basePath}/js/jquery.min.js?v=2.1.4"></script>
<script src="${basePath}/js/common.js"></script>
<script src="${basePath}/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${basePath}/js/plugins/iCheck/icheck.min.js"></script>
<script>
    $(document).ready(function () {
        $(".register").click(function () {
            $(".register").prop("disabled", true);
            var blag = true;
            $("[required='true']").each(function () {
                if ($.trim($(this).val()) == "") {
                    ShowMessage($(this).attr("placeholder"));
                    blag = false;
                    $(".register").prop("disabled", false);
                    return false;
                }
            })
            if (blag == false) {
                $(".register").prop("disabled", false);
                return;
            }

            var username = $("[name='username']").val();
            var password = $("[name='password']").val();
            var confirmpassword = $("[name='confrim-password']").val();
            if (blag == true && password != confirmpassword) {
                ShowMessage("两次密码输入不一致");
                $(".register").prop("disabled", false);
                return;
            }
            var manager = getFormData($("form"));
            AsyncPost("${basePath+registerUrl}", manager, function (result) {
                if (result.code == 0) {
                    ShowMessage(result.msg, function () {
                        window.location.href = "${basePath}/loginAndRegister/login";
                    });
                } else {
                    $(".register").prop("disabled", false);
                    ErrMessage(result.msg);
                }
            })
        });
    });
</script>
</body>
</html>